﻿@model PhoneBilling.Models.Report7ResultModel
@{
    ViewBag.Title = "话务状况统计";
    Layout = "~/Views/Shared/_Layout.cshtml"; 
}
<script type="text/javascript">
    $(document).ready(function () {
        $("#btnReturn").ligerButton(
        {
            click: function () {
                history.go(-1); //后退1页  
            }
        });
        $("#btnImport").ligerButton(
        {
            click: function () {
                $("form").submit();
            }
        });
    });
    
</script>
@using (Html.BeginForm("Report7", "Statistics"))
{
    @Html.HiddenFor(m => m.开始日期)
    @Html.HiddenFor(m => m.结束日期)
    @Html.Hidden("IsExport", true)
    <input type="button" id="btnReturn" value="返回" />
    <input type="button" id="btnImport" value="导出Excel" />
@*    <input type="button" value="返回" onclick="back()"/>  
    <input type="submit" value="导出Excel"/>  *@
    @*<div>
        @{
var grid = new WebGrid(source: Model.List, canPage: false);
        }
        @grid.GetHtml(
            alternatingRowStyle: "bg",
            columns: grid.Columns
            (
                  grid.Column("日期", "日期"),
                    grid.Column("话单总数", "话单总数"),
                    grid.Column("不明话单数目", "不明话单数目"),
                       grid.Column("重复话单数目", "重复话单数目"),
                       grid.Column("最大通话金额", "最大通话金额"),
                       grid.Column("最大通话时长", "最大通话时长")
            )
        )
    </div>*@
}
@{
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.AppendLine(string.Format("var data={{Total:{0},",Model.List.Count));
    sb.AppendLine("Rows:[");
    for(int i =0;i < Model.List.Count;i++)
    {
        var item = Model.List[i];
        if(i == 0)
        {
            sb.Append("{");
        }
        else
        {
            sb.Append(",{");
        }
        sb.Append(string.Format("日期:'{0}',", item.日期));

        sb.Append(string.Format("话单总数:'{0}',", item.话单总数));
        sb.Append(string.Format("不明话单数目:'{0}',", item.不明话单数目));
        sb.Append(string.Format("重复话单数目:'{0}',", item.重复话单数目));
        sb.Append(string.Format("最大通话金额:'{0}',", item.最大通话金额));
        sb.Append(string.Format("最大通话时长:'{0}'", item.最大通话时长));
        sb.Append("}");
    }
    sb.AppendLine("]};");
    string data = sb.ToString();
}
<script type="text/javascript">
    @Html.Raw(data)
    var grid;
    $(function () {

        grid = $("#maingrid").ligerGrid({
            columns: [
                { display: '日期', name: '日期',width:80},
                { display: '话单总数', name: '话单总数',width:140,totalSummary:                    {render: function (suminf, column, cell){                            return '<div>话单总数:' + suminf.max + '</div>';                        }}},
                { display: '不明话单数目', name: '不明话单数目',width:140,totalSummary:                    {render: function (suminf, column, cell){                            return '<div>不明话单总数:' + suminf.max + '</div>';                        }}},
                { display: '重复话单数目', name: '重复话单数目',width:140,totalSummary:                    {render: function (suminf, column, cell){                            return '<div>重复话单总数:' + suminf.max + '</div>';                        }}},
                { display: '最大通话金额', name: '最大通话金额',width:100},
                { display: '最大通话时长', name: '最大通话时长',width:100}],
                isScroll: false, data: data,pageSize:30,alternatingRow:true
        }
        );resetGridHeight(grid);
        $(window).resize(function () {
                resetGridHeight(grid);
            });
    });</script>
    <div id="maingrid"></div>